package com.framework.base.util;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

import org.apache.log4j.Logger;

/**
 * Description:读取表单配置的工具类 tabaleName(对应的表名): Company: framework
 * 
 * @author：HYH
 * @version 1.0
 * @Date 2011-6-2 下午02:15:09
 */
public class FormUtil {
	private static Map<String, String> formConfMap = new HashMap<String, String>();
	static Logger logger=Logger.getLogger(FormUtil.class);
	/**
	 * 将properties转化为map
	 * 
	 * @param key
	 * @return
	 */
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public static void initFormConf() {
		Properties formConfProp = new Properties();
		try {
			formConfProp.load(FormUtil.class
					.getResourceAsStream("/fromConf.properties"));
			formConfMap = new HashMap<String, String>((Map) formConfProp);
		} catch (IOException e) {
			LoggerUtil.logError(e, logger, "表单属性读取错误");
			e.printStackTrace();
		}
	}

	/**
	 * 根据key值来获取value值
	 * 
	 * @param key
	 * @return
	 */
	public static String getFormConfValueByKey(String key) {
		return formConfMap.get(key);

	}
}
